﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DNA.Mvc.Exporting.Exporters;

namespace DNA.Mvc.Exporting
{
    public interface IExporterFactory
    {
        void AddDirectory(string matchKey);

        void AddPackage(string matchKey = "Package");

        void AddWebTemplate(string matchKey = "Web");
    }

    public class DefaultExporterFactory : IExporterFactory
    {
        private ExporterContainer parentContainer;

        public DefaultExporterFactory(ExporterContainer container)
        {
            parentContainer = container;
        }

        public void AddDirectory(string matchKey)
        {
            parentContainer.Exporerts.Add(new FilesExporter() { MatchKey = matchKey });
        }

        public void AddPackage(string matchKey = "Package")
        {
            parentContainer.Exporerts.Add(new PackageExporter() { MatchKey = matchKey });
        }

        public void AddWebTemplate(string matchKey = "Web")
        {
            parentContainer.Exporerts.Add(new WebTemplateExporter() { MatchKey = matchKey });
        }
    }
}
